<?
include('/var/www/html/new/d/module/api/function.class.php');
if (!class_exists("go_sql")){
	include("/var/www/html/new/conf/le.je");
	$le=new go_sql();
	$le->connect();
}
$PFT_infunction = new AllFunction();

$account = $_REQUEST['account'] + 0;
$sql="select dname from pft_member where account='$account' limit 1";
$GLOBALS['le']->query($sql);
if(!$GLOBALS['le']->fetch_assoc())
	exit('{"status":"fail","msg":"账号不存在"}');	

$dname =$GLOBALS['le']->f('dname');
$outSidePWD = $PFT_infunction->Create_Conn_REC($account,$dname);

$submit_array = array(
	"account" => $account,		//账号
	"password" => $outSidePWD,	//密码
	"lid" => $_REQUEST['lid'],			//景区id
	'tid'=>$_REQUEST['tid'],				//门票id
	'remoorder'=>'',			//远端订单号
	'tprice'=>100,				//以分为单位的单价
	'num' =>$_REQUEST['tnum'], 				//数量
	'playtime' =>$_REQUEST['begintime'],  //游玩日期
	'name'=> $_REQUEST['ordername'],		//客人姓名
	'tel'=> $_REQUEST['ordertel'] ,			//客人手机号
	'sms'=>1,
	'paystatus'=>$_REQUEST['paystatus'],
	'tuanhao'=>$_REQUEST['tuanhao'],
	'aid'=>$_REQUEST['aid'], 				//供应商id
	'IDcard'=>$_REQUEST['IDcard'],  //客人身份证
	
);	 

$submit_order = $PFT_infunction->outSide_Submit($submit_array);
$submit_order_xml = simplexml_load_string($submit_order);
if((string)$submit_order_xml->Rec->UUordernum){
	$lastnum = $_REQUEST['totalnum'] - 1;
	$account = $_REQUEST['account'];
	$lid = $_REQUEST['lid'];
	$tid = $_REQUEST['tid'] ;
	$aid = $_REQUEST['aid'] ; 
	$begintime = $_REQUEST['begintime'];
	$ordername = $_REQUEST['ordername'];
	$paystatus = $_REQUEST['paystatus'];
	$ordertel = $_REQUEST['ordertel'];
	$ticket_info = $_REQUEST['ticket_info'];
	$UUbegintime = $_REQUEST['UUbegintime'];
	$UUendtime = $_REQUEST['UUendtime'];
	$ticket_textarea = $_REQUEST['ticket_textarea'];
	$paystatus = $_REQUEST['paystatus'];
	echo '{"totalnum":"'.$lastnum.'","account":"'.$account.'","lid":"'.$lid.'","tid":"'.$tid.'","aid":"'.$aid.'","begintime":"'.$begintime.'","UUendtime":"'.$UUendtime.'","ordername":"'.$ordername.'","ticket_info":"'.$ticket_info.'","UUbegintime":"'.$UUbegintime.'","ticket_textarea":"'.$ticket_textarea.'","paystatus":"'.$paystatus.'","paystatus":"'.$paystatus.'","ordertel":"'.$ordertel.'","ordernum":"'.(string)$submit_order_xml->Rec->UUordernum.'","code":"'.(string)$submit_order_xml->Rec->UUcode.'","status":"success"}';		
}
else{
	echo '{"status":"fail","msg":"'.(int)$submit_order_xml->Rec->UUerrorcode.'"}';
}
?>